from django.db import models
from subscriber.models import PlatformSubscriber


class Works(models.Model):
    id = models.AutoField(primary_key=True)
    platform_subsriber_id = models.ForeignKey(PlatformSubscriber, on_delete=models.DO_NOTHING, verbose_name='关联账户id',
                                              null=False, blank=False, db_constraint=False)
    third_id = models.CharField(verbose_name='第三方平台作品id', null=False, blank=True, max_length=30)
    name = models.CharField(verbose_name='作品名称', null=False, blank=False, max_length=30)

    class Meta:
        verbose_name = '作品表'

    def __str__(self):
        d = vars(self)
        d.pop('_state', '')
        return str(d)
